package com._520it.crm.web.controller;

import com._520it.crm.domain.OrderBill;
import com._520it.crm.page.AjaxResult;
import com._520it.crm.service.IPaymentConfirmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("paymentConfirm")
public class PaymentConfirmController {
    @Autowired
    private IPaymentConfirmService paymentConfirmService;

    @RequestMapping("confirm")
    @ResponseBody
    public AjaxResult confirm(OrderBill orderBillId) {
        AjaxResult result = null;
        try {
           paymentConfirmService.confirm(orderBillId.getOrderBillId());
            result = new AjaxResult("缴费成功");
        } catch (Exception e) {
            e.printStackTrace();
            paymentConfirmService.confirmFailed(orderBillId.getOrderBillId());
            result = new AjaxResult(false, "缴费失败");
        }
        return result;
    }
}
